import React from 'react';
import loadjs from 'loadjs';
import { WeaTools, WeaDialog, WeaLocaleProvider } from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
import { smsFiles } from '../constants/fileConfig';

export default class SendSms extends React.Component{
    constructor(){
        super();
        this.state = {hasLoad: false};
    }
    componentDidMount(){
        const init = () =>{
            this.setState({hasLoad:true});
        }
        loadjs.isDefined('sms') ? loadjs.ready('sms', init) : loadjs(smsFiles, 'sms', init);
    }
    render(){
        const { hasLoad } = this.state;
        if(hasLoad){
            const { SendSms } = window.weaSmallApp.com;
            const { visible,params,closeFun } = this.props;
            return (
                <WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@e38tla`}
                    visible={visible}
                    title={getLabel(16635,'发送短信')}
                    icon="icon-coms-workflow"
                    iconBgcolor='#0079DE'
                    className="wf-send-sms"
                    maskClosable={false}
                    onCancel={()=>{closeFun()}}
                    style={{width:"800px", height:"450px"}}
                >
                    <SendSms ecId={`${this && this.props && this.props.ecId || ''}_SendSms@s9yclh`} isCus={true} params={params} closeFun={()=>{closeFun()}} />
                </WeaDialog>
            );
        }else{
            return (<div></div>);
        }
        
    }
}